pp108 : Reference (xql)

Reference (xql)

It refers to the XPath of the data node of the business object to which the control is bound.

During design time, you can specify the appropriate XPath as Reference in a control's property sheet to bind the data to the control. At runtime, the specified XPath is used to retrieve the exact data associated with the control.

A control for which the Reference (xql) attribute is defined, is called a data-bound element. Controls for which the attribute is not defined are called free-form elements. You must also define the model property of the control. If not defined, the model associated with the parent control is considered.

For a transactional model for which WSDL exists, all available fields for the model display in the property sheet, and you can select the field to bind from the model. For a non-transactional model for which no WSDl exists, you must manually specify the XPath of the data node to which to bind the control.

Syntax

Designtime

The value for this property can be entered through the property sheet of the control.

Script

sXPath =ControlID.xql

Possible Values

sXPath

String that denotes the XPath of the data node in the businessObject to which this control is bound.

Remarks

This is a read-and-write property.

Consider the following XML response to a request for employees from the Northwind database.

<data>
    <GetEmployeesResponse xmlns="http://schemas.cordys.com/1.0/demo/northwind">
        <tuple>
            <old>
                <Employees>
                    <EmployeeID>1</EmployeeID>
                    <FirstName>Nancy</FirstName>
                    <LastName>Davolio</LastName>
                </Employees>
            </old>
        </tuple>
        <tuple>
            <old>
                <Employees>
                    <EmployeeID>2</EmployeeID>
                    <FirstName>Andrew</FirstName>
                    <LastName>Fuller</LastName>
                </Employees>
            </old>
        </tuple>
    </GetEmployeesResponse>
</data>

For each<tuple>, a row needs to be created in the XGrid.

However, a default namespace (xmlns) is specified on<GetEmployeesResponse>. All child nodes below theGetEmployeesResponsenode inherit this default namespace. You can also specify different namespaces for these nodes.

To obtain a valid XPath expression, a prefix needs to be applied for the namespace. For example, let us usenwdas a prefix of http://schemas.cordys.com/1.0/demo/northwind. This can be done in the Internet Explorer as follows.

[dataXMLDocument].setProperty("SelectionNamespaces", "xmlns:nwd= 'http://schemas.cordys.com/1.0/demo/northwind'");

Therefore, the row added for a tuple is as follows:

sXPath= "data/nwd:GetEmployeesResponse/nwd:tuple"

Applies to

Input, Output, Label, Password, Code Snippet, Table, Textarea, Button, Check, Radio, Image, Select, List, and XGrid.